#Extended Formal Parameter Syntax
print()
print("one")
print("one", "two")
print("one", "two", "three")

#Another example
"{a}<===>{b}".format(a="Oslo", b="Stavanger")


#Positional Arguments
#Calculating volumes of multi-dimentional objects
def hypervolume(*args):
    print(args)
    print(type(args))

hypervolume(3, 4)
hypervolume(3, 4, 5)

#args is just a tuple built from the values we passed it.
#The code will look like this - 
def hypervolume(*lengths):
    i = iter(lengths) #Get the iterator
    v = next(i) #Get the first value
    for length in i: #for each value multiply the result
        v *= length
    return v

hypervolume(2, 4)
hypervolume(2, 4, 6)
hypervolume(2, 4, 6, 8)
hypervolume(1)

#What about no parameters?
hypervolume()

#Odd error. Would prefer some thing like 'missing argument'
def hypervolume(length, *lengths):
    v = length
    for item in lengths:
         v *= item
    return v
    
hypervolume(3, 5, 7, 9)
hypervolume(3, 5, 7)
hypervolume(3, 5)
hypervolume(3)
hypervolume()